package com.spsy.order.controller.api;

import com.alibaba.fastjson.JSON;
import com.bw.spsy.vo.NotifyOrderVo;
import com.spsy.common.core.domain.R;
import com.spsy.order.domain.Order;
import com.spsy.order.order.OrderApi;
import com.spsy.order.service.IOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 上杉绘梨衣 && Sakura
 * @Yu 我们都是小怪兽，总有一天会被正义的奥特曼杀死。
 * @Yu "不知道从什么时候,我开始不喜欢社交，沉浸在自己的小圈子里"
 * @date 2025/9/22-20:28
 */
@RestController
@Slf4j
public class OrderOpsApiController implements OrderApi {

    @Autowired
    private IOrderService orderService;

    @Override
    public R createOrder(NotifyOrderVo notifyOrderVo) {

        log.info("notify:{}", JSON.toJSONString(notifyOrderVo));

        int i = orderService.updateOrderById(Order.builder().orderStatus(notifyOrderVo.getStatus()).orderNo(notifyOrderVo.getOrderId()).build());

        log.info("i:{}",i);

        return R.ok();
    }
}
